#pragma once

#include "Common.h"
#include "macros.h"

///////////////////////////////////////////////////////////////////////////////////////////////
/// International checkers bitboard move generator - used first 50 bits in double word
///////////////////////////////////////////////////////////////////////////////////////////////

namespace InternationalMoveGen
{
	/* bitboard masks for moves in various directions */
	/* here "1" means the squares in the columns 1357 and "2" in 2468.*/
	#define RF1_64   B64(00000000,00000000,00011111,00000111,11000001,11110000,01111100,00011111)
	#define RF2_64   B64(00000000,00000000,00000000,01111000,00011110,00000111,10000001,11100000)
	#define LF1_64   B64(00000000,00000000,00011110,00000111,10000001,11100000,01111000,00011110)
	#define LF2_64   B64(00000000,00000000,00000000,11111000,00111110,00001111,10000011,11100000)
	#define RB1_64   B64(00000000,00000000,00011111,00000111,11000001,11110000,01111100,00000000)
	#define RB2_64   B64(00000000,00000001,11100000,01111000,00011110,00000111,10000001,11100000)
	#define LB1_64   B64(00000000,00000000,00011110,00000111,10000001,11100000,01111000,00000000)
	#define LB2_64   B64(00000000,00000011,11100000,11111000,00111110,00001111,10000011,11100000)
	
	/* bitboard masks for jumps in various directions */
	#define RFJ1_64  B64(00000000,00000000,00000000,00000011,11000000,11110000,00111100,00001111)
	#define RFJ2_64  B64(00000000,00000000,00000000,01111000,00011110,00000111,10000001,11100000)
	#define LFJ1_64  B64(00000000,00000000,00000000,00000111,10000001,11100000,01111000,00011110)
	#define LFJ2_64  B64(00000000,00000000,00000000,11110000,00111100,00001111,00000011,11000000)
	#define RBJ1_64  B64(00000000,00000000,00001111,00000011,11000000,11110000,00111100,00000000)
	#define RBJ2_64  B64(00000000,00000001,11100000,01111000,00011110,00000111,10000000,00000000)
	#define LBJ1_64  B64(00000000,00000000,00011110,00000111,10000001,11100000,01111000,00000000)
	#define LBJ2_64  B64(00000000,00000011,11000000,11110000,00111100,00001111,00000000,00000000)

	/* back rank masks */
	#define WBR_64  B64(00000000,00000011,11100000,00000000,00000000,00000000,00000000,00000000)
	#define BBR_64  B64(00000000,00000000,00000000,00000000,00000000,00000000,00000000,00011111)
	#define NWBR_64 B64(00000000,00000000,00011111,11111111,11111111,11111111,11111111,11111111)
	#define NBBR_64 B64(00000000,00000011,11111111,11111111,11111111,11111111,11111111,11100000)

	void InitBitBoardGenerator();
	int GenerateBitBoardMoves(BitBoard64* bb, bool bWhite, BitBoardMove64* movelist);
	bool TestJump(BitBoard64* bb, bool bWhite);
	void ToggleMove(BitBoard64 *p, BitBoardMove64 *m);

	// TEST
	void DumpRayAttacks();
}
